static void prvAddNewTaskToReadyList(TCB_t *pxNewTCB)
{
  taskENTER_CRITICAL();
  {
    uxCurrentNumberOfTasks++;

    if (pxCurrentTCB == NULL)
    {
      pxCurrentTCB = pxNewTCB;

      if (uxCurrentNumberOfTasks == (UBaseType_t)1)
      {
        prvInitialiseTaskLists();
      }
    }
    else
    {
      if (pxCurrentTCB->uxPriority <= pxNewTCB->uxPriority)
      {
        pxCurrentTCB = pxNewTCB;
      }
    }
    uxTaskNumber++;

    prvAddTaskToReadyList(pxNewTCB);
  }
  taskEXIT_CRITICAL();
}